import {proxy} from "@@/exports";
import {SocialUserVO} from "@/services/SocialUserService";

interface SocialUserModelType {
    socialUser?: SocialUserVO;
    updateModalState: boolean;
}

const state = proxy<SocialUserModelType>({
    socialUser: undefined,
    updateModalState: false,
})

const actions = {
    /**
     * 设置修改模态框状态
     * @param modalState 状态
     */
    setUpdateModalState(modalState: boolean) {
        state.updateModalState = modalState
    },
    /**
     * 打开模态框
     * @param modalState
     * @param socialUser
     */
    openUpdateModal(modalState: boolean, socialUser?: SocialUserVO) {
        state.socialUser = socialUser
        state.updateModalState = modalState
    },
};


export const SocialUserModel = {state, actions}